<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>姓名：{{person.name}}</p>
        <p>性别：{{person.sex}}</p>
        <button @click='handleClick'>按钮</button>
    </div>
    <script src="../vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data () {
                return {
                    person:{
                        name:'张',
                    }
                }
            },
            methods: {
                handleClick(){
                    //this.person.sex='女';
                    this.$set(this.person,'sex','女');  //getter和setter
                }
            }
        })
    </script>
</body>
</html>